const http=require('http')
const url=require('url')
 

const server=http.createServer((req,res)=>{
   // const path=url.parse(req.url) 
   //返回的路径 没有参数
   if(req.url==='/login'){
       if(req.method==='POST'){
        req.setEncoding('utf-8')
        req.on('data',(data)=>{
             //通过JSON把data字符串解析成对象
             console.log(data)
             const {username,password}=JSON.parse(data)
            console.log(username)
              
       })
       }
   }
 
     res.end("结束")
})
server.listen('8000','0.0.0.0',()=>{
     console.log("启动成功")
})